<template>
  
  <view class="category">
    <navigator class="category-item" :url="`/pages/category/category?index=${index}`" hover-class="none" v-for="(item, index) in list" :key="item.id">
      <image class="icon" :src="item.icon">
      </image>
      <text class="text">{{item.name}}</text>
    </navigator>
  </view>

</template>

<script setup lang="ts">

import type { CategoryItem } from "@/types/home"
import { ref } from 'vue'

defineProps<{
  list: CategoryItem[]
}>()

</script>

<style lang="scss">

.category {
  margin: 20rpx 0 0;
  padding: 10rpx 0;
  display: flex;
  flex-wrap: wrap;
  min-height: 328rpx;
  row-gap: 20rpx;
  .category-item {
    display: flex;
    width: 20%;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    box-sizing: border-box;
    .icon {
      width: 100rpx;
      height: 100rpx;
    }

    .text {
      font-size: 26rpx;
      color: #666;
      display: block;
      text-align: center;
    }
  }
}

</style>